const express = require('express');
const router = express.Router();
const data = [];
const CBUdata = [];
for(let i = 1; i < 51; i++)
    data.push({
        id: `${i}`,
        code: `code${i}`,
        name: `name${i}`,
        color: 'string',
        version: 'string',
        package: 'string',
        displacement: 'string',
        transmission: 'string',
        fuelType: 'string',
        interior: 'string',
        remark: 'string',
        modelCode: 'string',
        modelName: 'string',
        modelId: 'string',
        engineModelName: 'string',

    });
for(let i = 1; i < 51; i++)
    CBUdata.push({
        id: `${i}`,
        PICode: `PICode${i}`,
        country: 'string',
        paymentType: 1,
        tradeMethodName: 'string',
        currency: 0,
        details: [
            {
                id: 'string1',
                productGroupCode: 'string',
                productGroupName: 'string',
                quantity: 0
            }, {
                id: 'string2',
                productGroupCode: 'string',
                productGroupName: 'string',
                quantity: 0
            }, {
                id: 'string3',
                productGroupCode: 'string',
                productGroupName: 'string',
                quantity: 0
            }]

    });

router.get('/', (req, res) => {
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content: data,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});
router.get('/forCBUSaleOrder', (req, res) => {
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content: data,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});

router.get('/forSalePlanOrder', (req, res) => {
    const content = [];
    for(let i = 0; i < 40; i++) content.push({
        id: `${i + 1}`,
        materialGroupCode: 'string',
        PublicationNumber: 'string',
        modelCode: 'string',
        modelName: 'string',
        transmission: 'string',
        engineModelName: 'string',
        gearboxModel: 'string'
    });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 40,
        }
    });
});
router.get('/forSaleOrderForecastOrder', (req, res) => {
    const content = [];
    for(let i = 0; i < 40; i++) content.push({
        id: `${i + 1}`,
        code: 'string',
        name: 'string',
        engineModelName: 'string',
        gearboxModel: 'string'
    });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 40,
        }
    });
});
router.get('/forCBUSaleOrder', (req, res) => {
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content: data,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});

module.exports = router;
